package com.example.demo.error;

public class DirectMemoryOOMDemo {


    private static final int _M = 1024 * 1024;

    public static void main(String[] args) throws IllegalAccessException {
//        Field declaredField = Unsafe.class.getDeclaredFields()[0];
//        declaredField.setAccessible(true);
//        Unsafe unsafe = (Unsafe) declaredField.get(null);
//        while (true){
//            unsafe.allocateMemory(_M);
//        }

        String str = "abc";
        String abc = new String("abc");
        System.out.println(abc);
    }

}
